<!DOCTYPE html>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<jsp:include page="/pad/common/commonCss.jsp"/>
<jsp:include page="/pad/common/commonJs.jsp"/>

<script  type="text/javascript" src="${basePath }pad/commonJs/jquery.min.js"></script>
<script  type="text/javascript" src="${basePath }pad/commonJs/jquery.easyui.min.js"></script>
<!-- 统一提示js -->
<script  type="text/javascript" src="${basePath }pad/commonJs/message.js"></script>
<script  type="text/javascript" src="${basePath }pad/commonJs/jt_map.js"></script>
<script  type="text/javascript" src="${basePath }pad/commonJs/jt_normal.js"></script>
<script  type="text/javascript" src="${basePath}pad/commonJs/tags/My97DatePicker/WdatePicker.js"></script>
<script src="${basePath}commonJs/jquery.imageScroller.js"></script> 
<link rel='stylesheet' href='${basePath}commonCss/css/fullcalendar-tuanti.css'  />
<link rel='stylesheet' media='print'  href='${basePath}commonCss/css/fullcalendar.print-tuanti.css' />
<link rel="stylesheet"   type="text/css" href="${basePath}commonCss/css/baseDatePicker/ui.all.css" />
<title>嘉童游乐中心</title>
<script type="text/javascript">
var  testVal="isCan";
var roomArray=null;
var fangArray=[];
var parReDateArray=[];
var fanglength =0;
var baseLocalPath='${basePath}';
var parStatus=new Array("未预付","自动取消","取消","待确认","已确认","进行中","完成","删除");
$(document).ready(function() {
	initRili();
});

function initRili(){
	  getparRoomList();
	  roomArray= new   Array();    
	<c:forEach items="${listRoom}" var="parRoom" varStatus="status">
	  roomArray['${status.index}']='${parRoom.roomName}-';
	  </c:forEach>
	  fanglength =roomArray.length;
	var customerDate = parReDateArray[0];
	$("#selectDate").val(customerDate);
	$('#calendar').fullCalendar('destroy');
	$("#modiBy").val('${userIddq}');
	$("#fkBranId").val('${branIddq}');
	$("#locale").change(function() {
		$('#calendarInput').datepicker('option', $.extend({showMonthAfterYear: true},
			$.datepicker.regional[$(this).val()]));
	});
	$(".datepicker").datepicker({minDate: -3,maxDate: 3});
	renderCalendar(customerDate);
}
//点击时间获取预约信息
function  getInfo(dp){
	if(checkIsNull(dp.cal.getNewDateStr())){
		return;
	}else{
		$('#calendar').fullCalendar('destroy');
		renderCalendar(dp.cal.getNewDateStr());
	}
}
function quearyList(){
	initRili();
}
function getRooms(){
	 var url ='${basePath}parreserve/getRooms.shtml';
		$.ajax({
			   url: url,
			   type: 'POST',
			   dataType:"json",
			  // data:$("#formView").serialize(),//序列化表单里所有的内容
			   async:false, 
			   error : function(XMLHttpRequest) {
				   ajaxError(XMLHttpRequest);
				  },
			   success:function(data){
					  roomArray= new   Array();    
					  trimJsonArray(data);
					  for(var i=0;i<data.length;i++){
						  roomArray[i]=data[i].roomName;
					  }
					  fanglength =roomArray.length;
			   }
		});
}
function getparRoomList(){ //查询 预约房间列表，在 日历控件 模式中显示  
	 var url ='${basePath }parreserve/findParReserveRooMList.shtml';
	$.ajax({
		   url: url,
		   type: 'POST',
		   data:$("#formView").serialize(),//序列化表单里所有的内容
		   async:false, 
		   error : function(XMLHttpRequest) {
			   ajaxError(XMLHttpRequest);
		   },
		   success:function(data){
				if (data != null) {
					 var customerDate;
					var jsonarray ;
					fangArray=[];
					 for(var o in data){
						 if(o=="parResDateList"){
							 parReDateArray=data[o];
							   customerDate=parReDateArray[0];
							 $("#selectDate").val(customerDate);
						 }
						 if(o=="gblparResRoomMap"){
							 jsonarray=data[o];
							// var obj = str.parseJSON(); start: '2014-06-12T10:00:00',
					//end: '2014-06-12T12:00:00'
							 for (var k = 0; k < jsonarray.length; k++){
								 fangArray.push();
								 var jsonobj = jsonarray[k];
								 var statusInt=jsonobj["resStatus"];
								 var parStatusName=parStatus[statusInt-1];
								 var subject=jsonobj["subject"];
								 var conName=jsonobj["conName"];
								 if(conName==null){
									 conName ="";
								 }
								 if(subject==null){
									 subject ="";
								 }
								 if(subject.length>12){
									 subject =subject.substring(0,12)+"...";
								 }
								 if(conName.length>12){
									 conName =conName.substring(0,12)+"...";
								 }
								 var fangid=jsonobj["roomName"]+"-"+jsonobj["roomId"]+"@"+jsonobj["lockFlag"];
								 var partitle=jsonobj["roomName"]+"-"+parStatusName+"\n"+subject+"\n"+conName+" "+jsonobj["conMobile"];
								 var parStart=jsonobj["presDay"]+"T"+jsonobj["resTimeS"];
								 var parEnd=jsonobj["presDay"]+"T"+jsonobj["resTimeE"];
								 var grpFlag =jsonobj["grpFlag"]; 
								 var pkParresId =jsonobj["pkParresId"];
								 var  detailUrl='${basePath }parreserve/editReservationPage.shtml?pkParresId='+pkParresId+'&grpFlag='+grpFlag;
								 var testJson = { "id": fangid, "title":partitle,"start":parStart,"end":parEnd,"url":detailUrl};
								 fangArray.push(testJson);
								  
							 }
						 }
					 }
					 
				}else{
					 alertError('加载预约房间失败！');
				}
		   }
		  });
}
var oldDateIndex=0;
function qtyUpdate(kind){// 上一条，下一条 按钮 ，操作 
	var maxLength=0;
	if( parReDateArray.length>1){
		maxLength= parReDateArray.length-1;
	}
    if(kind == "next"){
    	 if(oldDateIndex== maxLength){//初始化 加载页面时，只能点击 上一条 按钮fangArray。
         	alertWarning('请先点击 上一条 按钮！');
              return;
         }else   oldDateIndex++;
    }else if(kind == "pre"){
        if(oldDateIndex==0){//初始化 加载页面时，只能点击 上一条 按钮。
        	alertWarning('请先点击 下一条 按钮！');
             return;
        }else if(oldDateIndex > 0) oldDateIndex--;
    }
    $('#calendar').fullCalendar('destroy');
    var setDaten = parReDateArray[oldDateIndex];
    //setdatepicker(setDaten,true);
    renderCalendar(setDaten);
}

</script>

<script  type="text/javascript" src='${basePath}pad/commonJs/lib/moment.min.js'></script>
<script  type="text/javascript" src='${basePath}pad/commonJs/lib/jquery-ui.custom.min.js'></script>
<script  type="text/javascript" src='${basePath}pad/commonJs/fullcalendar_tuanti.js'></script>
<script  type="text/javascript" src='${basePath}pad/commonJs/lang-all.js'></script>
<script  type="text/javascript" src='${basePath}pad/commonJs/jquery.fancybox-1.3.1.pack.js'></script>
<script type="text/javascript" src="${basePath}pad/commonJs/ui/ui.core.js"></script>
<script type="text/javascript" src="${basePath}pad/commonJs/ui/ui.datepicker.js"></script>
<script type="text/javascript" src="${basePath}pad/commonJs/ui/ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="${basePath}pad/commonJs/jquery.form.min.js"></script>
<script type="text/javascript"  src="${basePath}pad/commonJs/jt_normal.js"></script>
<script type="text/javascript" src="${basePath}pad/commonJs/order_group.js"></script>
<script type="text/javascript" src="${basePath}pad/commonJs/calendar.js"></script>
</head>
<body>
<div class="i_index">
    <div class="i_index_l fl">
    	<h1><a href="${basePath}system/user/updatePadPass.shtml"><i class="icon iconfont">&#xe60f;</i><br>${user.name}</a></h1>
        <ul>
        	<li><a href="${basePath }system/index.shtml?mode=pad"><i class="icon iconfont">&#xe600;</i><br>首页</a></li>
            <li><a href="${basePath}filemanagement/findVipInfo.shtml"><i class="icon iconfont">&#xe603;</i><br>会籍</a></li>
            <li class="i_index_l_hover"><a href="${basePath}parreserve/reservationPage.shtml"><i class="icon iconfont">&#xe604;</i><br>预约</a></li>
            <li><a href="${basePath }goods/padSales.shtml"><i class="icon iconfont">&#xe602;</i><br>消费管理</a></li>
        </ul>
    </div>
    <form id="formView">
    <div class="i_index_r fl oh">
       	<!----内容-->
        <div class="p20">
    	<div class="file_single_dl_i f14 fixed">
        	<dl style="overflow:hidden" class="fixed">
            	<dd><label>联系人\手机\主题：</label><input type="text" id="subject"    name="subject"  class="iput_t w200"></dd>
                <dd class="fr"><label>会员生日：</label>
                	<input type="text" title="" name="resTimeS" id="resTimeS" onclick="WdatePicker({dateFmt:'yyyy/MM/dd',isShowWeek:true,isShowClear:true,readOnly:true})" class="Wdate iput_t w82" readonly="readonly">
                    <span class="mlr5">至</span>
                	<input type="text" title="" name="resTimeE" id="resTimeE"   onclick="WdatePicker({dateFmt:'yyyy/MM/dd',isShowWeek:true,isShowClear:true,readOnly:true})" class="Wdate iput_t w82" readonly="readonly">
               </dd>  	
                 <dd><label>类型：</label>
                 	<div class="uboxstyle">
                        <select name="grpFlag" id="grpFlag">
                            <option selected="" value="">全部</option>
                            <option value="0">派对预约</option>
                            <option value="1">团体预约</option>
                        </select>
                    </div>
                </dd>
                <dd class="fr"><label>关联专员：</label>
                	<div class="uboxstyle">
                        <select name="modiBy" id="modiBy">
                            <option value="">全部</option>
                            <c:forEach items="${listuserPar}" var="userP" >
                            <option value="${userP.pkUsrId}">${userP.usrName}</option>
                            </c:forEach>
                        </select>
                    </div>
                </dd>
                <dd><label>状态：</label>
                	<div class="uboxstyle">
                        <select name="resStatus" id="resStatus">
                            <option value="">全部</option>
                            <option value="1">未预付</option>
                            <option value="2">自动取消</option>
                            <option value="3">取消</option>
                            <option value="4">待确认</option>
                            <option value="5">已确认</option>
                            <option value="6">进行中</option>
                            <option value="7">完成</option>
                        </select>
                    </div>
                </dd>
                <dd class="fr">
                	<input type="button" value="预约" class="btn fr ml10"onclick="window.location.href='${basePath }parreserve/ToReservationPage.shtml?parType=1&pkParresId=&pkOrderId='" >
					<input type="button" value="搜索"  onclick="quearyList();" class="btn fr ml10">
                </dd>
            </dl>
        </div>
        <div class="mt10">
        	<h2>选择日期：<input type="text" title="" name="date1" id="selectDate" onFocus="WdatePicker({onpicking:function(dp){getInfo(dp);}});" class="Wdate iput_t w150" readonly="readonly"></h2>
        </div>
        <div id='calendar' class="data_l mt10"></div>
        </div>
        <!---内容--->
    </div>
      </form>
</div>
</body>
</html>
